import java.io.*;

public class IOTest02 {
    public static void main(String[] args) {
        FileReader reader = null;
        FileWriter writer = null;
        try {
            reader = new FileReader("copy.txt");
            writer = new FileWriter("E:\\javacode\\20230518\\src\\copyTest\\copy.txt");
            char [] arr = new char[4];
            int readCount = 0;
            while ((readCount = reader.read(arr)) != -1 ) {
                writer.write(arr,0,readCount);
            }
            writer.flush();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }

    }
}
